#ifndef _OPENCC_GENERAL_H_
#define _OPENCC_GENERAL_H_

#ifndef NULL
#define NULL ((void *)(0))
#endif
#define CC_INT_MAX 32767

#define CC_CMP_TABLE_SIZE(cc_table)  (sizeof((cc_table))/sizeof((cc_table)[0]))

typedef enum CC_COMMON_CHARACTER_TYPE
{
    CC_CHARC_TYPE_UTF8 = 0,
    CC_CHARC_TYPE_GBK,
    CC_CHARC_TYPE_UTF16_LE,
    CC_CHARC_TYPE_UTF16_BE,
    CC_CHARC_TYPE_ISO9959,
    CC_CHARC_TYPE_GSM7,
    CC_CHARC_TYPE_END
} CC_COMMON_CHARACTER_TYPE_E;

typedef struct opencc_info {
    void *buf;
    int buf_size;
    int char_type;
} opencc_info_t;

typedef struct cc_charc_set
{
    /**
     * character encoding tag
     */
    CC_COMMON_CHARACTER_TYPE_E charc_type;

    /**
     * minimal bytes for a character
     */
    unsigned char min;

    /**
     * maximum bytes for a character
     */
    unsigned char max;

    /**
     * suggested replacement for invalid character
     */
    unsigned char unknown_char;

    
    int (*charc_set_to_unicode)(const void *in, unsigned size, unsigned long *val);

    
    int (*unicode_to_charc_set)(unsigned long val, void *out, unsigned size);
} cc_charc_set_t;

#endif /* _OPENCC_GENERAL_H_ */

